#!/usr/local/bin/python3
# *_* coding: UTF-8 *_*
# @IDE: PyCharm
# @Version: Python3.97
# @Author: Kendrick.Kc
# @Email: 509556985@qq.com
# @File: settings.py
# @Inst: 配置文件
# @Time: 2023/6/26 16:05
# -----

# 账户密钥
# api_key = "M8dOBYKoB5t8PMFn96XmO3lk5qoTraVpXX2VVqWwHIWmA58HsfdPavqVtW2gz6DP"
# secret_key = "aKg8XdKHbIsHNsU6CkmXQ6bSEWJQdF9upNTwNmkkfJlLaZ7nbGoGqve72uWLnEBf"


import basic
from multiprocessing import cpu_count


class Parameter:
    """
    动态参数
    """

    cpu_number = 2  # 核数    # 临时使用  到时候需换成 cpu_count()
    set_balance = 50  # 程序启动最低的余额数，单位U
    set_margin = 5  # 保证金百分比
    set_min_dgs_number = 8  # 最小的DGS数量
    cpu_count_number = 3  # 单核线程数

    """
    固定参数类
    """

    this_balance = set_balance * cpu_number  # 程序启动默认的USDT数量（模拟账户）
    this_margin = set_margin * cpu_number  # 保证金百分比% 例子20/30/40/50 - 同时也是一个币种需要的最少USDT数量

    # 程序进程参数
    trading_count_number = cpu_count_number * cpu_number  # 线程总数量

    # 交易规则参数
    symbol = None  # 交易货币
    isolated = "ISOLATED"  # 逐仓模式
    ccy = "USDT"  # 计价货币
    this_min_qty = None  # 订单最小数量限制
    this_price_decimal = None  # 价格小数点位数
    this_decimal = None  # 下单数量小数点位数
    this_min_notional = None  # 最小下单金额(交易所最小下单价格时5U)
    commission = 0.0004  # 手续费
    min_dgs_number = set_min_dgs_number  # 最小的DGS数量

    # DB参数
    db_coll_balance_init = f"{basic.Exchange.binance}_{basic.Strategy.era}_init_balance"  # 初始余额
    db_coll_balance_timeStamp = f"{basic.Exchange.binance}_{basic.Strategy.era}_time_stamp"  # 时间戳
    db_coll_balance = f"{basic.Exchange.binance}_{basic.Strategy.era}_balance"  # 账户可用余额
    db_coll_trading_symbol = f"{basic.Exchange.binance}_{basic.Strategy.era}_trading"  # 正在交易的交易对
    db_coll_construct_process = f"{basic.Exchange.binance}_{basic.Strategy.era}_construct"  # 策略构建的进程号
    db_coll_high_volatility = f"{basic.Exchange.binance}_{basic.Strategy.era}_volatility"  # 高波动率交易对
    db_coll_program = f"{basic.Exchange.binance}_{basic.Strategy.era}_program"  # 自动停止程序的数据表 # 只平仓不开仓
    db_coll_symbol_new_ticker_price = f"{basic.Exchange.binance}_{basic.Strategy.era}_ticker_price "  # 交易对最新价格数据表
    db_coll_min_dgs = f"{basic.Exchange.binance}_{basic.Strategy.era}_min_dgs"  # 记录最小DGS数的交易对
    db_coll_fgi = f"{basic.Exchange.binance}_{basic.Strategy.era}_fear_and_greed_index"    # 恐慌与贪婪指数
